<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/javascript">
    function getAnalyse1(){
        var _Str='{"name":"DingYong","Dept":"信息工程学院","email":"dingy@qq.com"}';
        var _Json=JSON.parse(_Str);
        console.info(_Json);
        document.getElementById("result1").innerHTML="<li>"+_Json.name+"</li>"+"<li>"+_Json.Dept+"</li>"+"<li>"+_Json.email+"</li>";
    }

    function getAnalyse2(){
        var _Str='{"people":[{"name":"丁勇","course":"网站前端技术","dept":"软件系\"},{"name":"张华","course":"Linux","dept":"网络系"},{"name":"李剑峰","course":"J2EE","dept":"软件系"}]}';
        var _Json=JSON.parse(_Str);
        console.info(_Json);
        var result="";
        for(var i=0;i<_Json.people.length;i++){
            result+="<table><tr><td>"+_Json.people[i].name+"</td><td>"+_Json.people[i].course+"</td><td>"+_Json.people[i].dept+"</td></tr></table>";
        }
        document.getElementById("result2").innerHTML="<table><tr><td>姓名</td><td>课程</td><td>院系</td></tr></table>"+result;
    }

    function getAnalyse3(){
        var _Str='{"name":"中国","province":[{"name":"云南省","cities":{"city":["昆明市","红河州"]}},{"name":"广东省","cities":{"city":["广州市","深圳市","珠海市"]}}]}';
        var _Json=JSON.parse(_Str);
        console.info(_Json);
        result="";
        for(var i=0;i<=_Json.province.length-1;i++){
            for(var j=0;j<=_Json.province[i].cities.city.length-1;j++){
                result+=_Json.name+_Json.province[i].name+_Json.province[i].cities.city[j]+"&nbsp;";
            }
            document.getElementById("result3").innerHTML=result;
        }
    }
    </script>
</head>
<body>
    <input type="button" value="解析字符串" onclick="getAnalyse1(),getAnalyse2(),getAnalyse3()">
    <div id="result1"></div>
    <div id="result2"></div>
    <div id="result3"></div>
</body>
</html>